
local SGame=Class()

function SGame:Construct()
    self.BtnAffirmLogin.OnClicked:Add(self,self.AffirmLogin)
    self.BtnReturnRegister.OnClicked:Add(self,self.ReturnRegister)
end



function SGame:ReturnRegister()
    UI.GetUI("login").SwitchWidget:SetActiveWidgetIndex(1)
end

function SGame:AffirmLogin()
    local Message =UE4.FLoginMessage()
    Message.Account=self.TextAaccount:GetText()
    Message.Password=self.TextPassword:GetText()
    Message.ReturnID=-1
    Message=GetMySQLSub(self):LoginDetection(Message)
    print(Message.ReturnID)
    if Message.ReturnID<1 then
        Err("登陆失败")
        return
    end
    SavePlayerID(Message.ReturnID)
    if GetMySQLSub(self):IsPlayerHaveReadyInfo(Message.ReturnID) then
        GoToGameServer(self)
    else
        Warning("123")
        GoToReadyServer(self)
    end
end


return SGame